/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package p2a;

/**
 *
 * @author user
 */
public class TestCase {
    
    private int ruleNmber;
    private int testCaseNumber;
    private int id;
    private String srcIp;
    private String srcPort;
    private String destIp;
    private String destPort;
    private String protocol;
    private String action;
    private String testResult;
    private String flag;

    public String getFlag() {
        return flag;
    }

    public void setFlag(String flag) {
        this.flag = flag;
    }

    @Override
    public String toString()
    {
        return srcIp + " " + srcPort + " " + destIp + " " +destPort + " "+ action+" "+flag;
    }
    public String getAction() {
        return action;
    }

    public void setAction(String action) {
        this.action = action;
    }

    public String getDestIp() {
        return destIp;
    }

    public void setDestIp(String destIp) {
        this.destIp = destIp;
    }

    public String getDestPort() {
        return destPort;
    }

    public void setDestPort(String destPort) {
        this.destPort = destPort;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getProtocol() {
        return protocol;
    }

    public void setProtocol(String protocol) {
        this.protocol = protocol;
    }

    public int getRuleNmber() {
        return ruleNmber;
    }

    public void setRuleNmber(int ruleNmber) {
        this.ruleNmber = ruleNmber;
    }

    public String getSrcIp() {
        return srcIp;
    }

    public void setSrcIp(String srcIp) {
        this.srcIp = srcIp;
    }

    public String getSrcPort() {
        return srcPort;
    }

    public void setSrcPort(String srcPort) {
        this.srcPort = srcPort;
    }

    public int getTestCaseNumber() {
        return testCaseNumber;
    }

    public void setTestCaseNumber(int testCaseNumber) {
        this.testCaseNumber = testCaseNumber;
    }

    public String getTestResult() {
        return testResult;
    }

    public void setTestResult(String testResult) {
        this.testResult = testResult;
    }
 
    public void bind(Rule R)
    {
        setProtocol(R.getProtocol());
        setRuleNmber(R.getOrder());
        setSrcIp(R.getSrcIp());
        setSrcPort(R.getSrcPort());
        setDestIp(R.getDestIp());
        setDestPort(R.getDestPort());
        setAction(R.getAction());
    }
    public void inverseAction()
    {
        if(action.equalsIgnoreCase("accept"))
            action = "deny";
        else if(action.equalsIgnoreCase("deny"))
            action = "accept";
        else action = "deny";
    }
    
    public void switchIPs()
    {
        String help = srcIp;
        srcIp = destIp;
        destIp = help;
    }
}
